package com.ruoyi.project.beautyflower.paymentHistory.service;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.beautyflower.paymentHistory.mapper.PaymentHistoryMapper;
import com.ruoyi.project.beautyflower.paymentHistory.domain.PaymentHistory;
import com.ruoyi.project.beautyflower.paymentHistory.service.IPaymentHistoryService;
import com.ruoyi.common.support.Convert;

/**
 * 还款记录 服务层实现
 * 
 * @author lxs
 * @date 2018-10-18
 */
@Service
public class PaymentHistoryServiceImpl implements IPaymentHistoryService 
{
	@Autowired
	private PaymentHistoryMapper paymentHistoryMapper;

	/**
     * 查询还款记录信息
     * 
     * @param id 还款记录ID
     * @return 还款记录信息
     */
    @Override
	public PaymentHistory selectPaymentHistoryById(Integer id)
	{
	    return paymentHistoryMapper.selectPaymentHistoryById(id);
	}
	
	/**
     * 查询还款记录列表
     * 
     * @param paymentHistory 还款记录信息
     * @return 还款记录集合
     */
	@Override
	public List<PaymentHistory> selectPaymentHistoryList(PaymentHistory paymentHistory)
	{
	    return paymentHistoryMapper.selectPaymentHistoryList(paymentHistory);
	}
	
    /**
     * 新增还款记录
     * 
     * @param paymentHistory 还款记录信息
     * @return 结果
     */
	@Override
	public int insertPaymentHistory(PaymentHistory paymentHistory)
	{
	    return paymentHistoryMapper.insertPaymentHistory(paymentHistory);
	}
	
	/**
     * 修改还款记录
     * 
     * @param paymentHistory 还款记录信息
     * @return 结果
     */
	@Override
	public int updatePaymentHistory(PaymentHistory paymentHistory)
	{
	    return paymentHistoryMapper.updatePaymentHistory(paymentHistory);
	}

	/**
     * 删除还款记录对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deletePaymentHistoryByIds(String ids)
	{
		return paymentHistoryMapper.deletePaymentHistoryByIds(Convert.toStrArray(ids));
	}

	@Override
	public String getPaymentTotal(String memberId) {
		return paymentHistoryMapper.getPaymentTotal(memberId);
	}

	/**
	 * 根据用户id查询还款记录
	 * @param memberId
	 * @return
	 */
	@Override
	public List<PaymentHistory> findPaymentHistoryListByUserId(Integer memberId) {
		return paymentHistoryMapper.findPaymentHistoryListByUserId(memberId);
	}

	/**
	 * 根据交易流水号查询还款记录
	 * @param paymentNo
	 * @return
	 */
	@Override
	public List<PaymentHistory> findPaymentHistoryListBypaymentNo(String paymentNo) {
		return paymentHistoryMapper.findPaymentHistoryListBypaymentNo(paymentNo);
	}

}
